#include "state_gameplay.h"
#include "../error.h"

using namespace Game;

GameplayState::GameplayState(GameEngine& owner, Game::Campaign& campaign)
	: GameState(owner), campaign_(campaign)
{
	if (campaign_.getNumOfLevels() > 0)	
		campaign_.setLevel(0);
	else
		throw Exception("No levels in campaign"); 
}

void GameplayState::updatePlayer(const int msPassed)
{
	Player& player = campaign_.getPlayer();
	// process input in some way, etc
}

void GameplayState::draw()
{
	campaign_.getLevel().draw();
	campaign_.getPlayer().draw();
}

void GameplayState::update(const int msPassed)
{
	updatePlayer(msPassed);
	campaign_.getLevel().update(msPassed);
}